////////////////////////////////////////////////////////////////////////////////
//  
//  Copyright (c) 2010 Gabriel Montagné Láscaris-Comneno and Alberto
//  Brealey-Guzmán.
//  
//  Permission is hereby granted, free of charge, to any person obtaining a
//  copy of this software and associated documentation files (the "Software"),
//  to deal in the Software without restriction, including without limitation
//  the rights to use, copy, modify, merge, publish, distribute, sublicense,
//  and/or sell copies of the Software, and to permit persons to whom the
//  Software is furnished to do so, subject to the following conditions:
//  
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//  
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
//  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//  DEALINGS IN THE SOFTWARE.
//  
////////////////////////////////////////////////////////////////////////////////

package com.rojored.controls.dragSurfaceClasses 
{

import flash.events.Event;

/**
 *  The DragSurfaceEvent class represents event objects that are specific to
 *  the DragSurface control.
 */
public class DragSurfaceEvent extends Event
{

    //--------------------------------------------------------------------------
    //
    //  Class constants
    //
    //--------------------------------------------------------------------------

    /**
     *  the <code>DragSurfaceEvent.HORIZONTAL_INDEX_CHANGED</code> constant
     *  defined the event type of an horizontal index change event object.
     */
    public static const HORIZONTAL_INDEX_CHANGED:String = "horizontalIndexChanged";

    /**
     *  the <code>DragSurfaceEvent.VERTICAL_INDEX_CHANGED</code> constant
     *  defined the event type of an vertical index change event object.
     */
    public static const VERTICAL_INDEX_CHANGED:String = "verticalIndexChanged";

    /**
     *  the <code>DragSurfaceEvent.DRAG_START</code> constant defined the
     *  event type of an drag start event object.
     */
    public static const DRAG_START:String = "dragStart";

    /**
     *  the <code>DragSurfaceEvent.DRAG_STOP</code> constant defined the
     *  event type of an drag stop event object.
     */
    public static const DRAG_STOP:String = "dragStop";

    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor
     */
    public function DragSurfaceEvent(type:String, 
                                     horizontalIndex:Number = NaN,
                                     verticalIndex:Number = NaN,
                                     bubbles:Boolean = false,
                                     cancelable:Boolean = false)

    {
        super(type, bubbles, cancelable);
        this.horizontalIndex = horizontalIndex;
        this.verticalIndex = verticalIndex;
    }

    //--------------------------------------------------------------------------
    //
    //  Properties 
    //
    //--------------------------------------------------------------------------

    //--------------------------------------
    //  horizontalIndex 
    //--------------------------------------

    /**
     *  current horizontal index of the associated DragSurfaceEvent component.
     */
    public var horizontalIndex:Number;

    //--------------------------------------
    //  verticalIndex 
    //--------------------------------------

    /**
     *  current vertical index of the associated DragSurfaceEvent component.
     */
    public var verticalIndex:Number;

    //--------------------------------------------------------------------------
    //
    //  Overridden methods
    //
    //--------------------------------------------------------------------------

    /**
     *  @private
     */
    override public function clone():Event 
    {
        return new DragSurfaceEvent(type, horizontalIndex,
            verticalIndex, bubbles, cancelable);
    }

    /**
     *  @private
     */
    override public function toString():String 
    {
        return formatToString(
            "DragSurfaceEvent",
            "type",
            "horizontalIndex",
            "verticalIndex",
            "bubbles",
            "cancelable",
            "eventPhase"
        );
    }
}
}
